#include <iostream>
using namespace std;

struct Animal
{
    int n;

public:
    Animal(){}
    Animal(int n) : n(n) { cout << "动物" << n << endl; }
    ~Animal() { cout << "动物析构" << endl; }
};

struct  horse :virtual public Animal
{
    int n;
public:
    horse(){}
    horse(int n, int m) : n(n), Animal(m) { cout << "马" << n << endl; }
    ~horse() { cout << "马析构" << endl; }
};

struct  donkey :virtual public Animal
{
    int n;
public:
    donkey(){}
    donkey(int n, int m) : n(n), Animal(m) { cout << "驴" << n << endl; }
    ~donkey() { cout << "驴析构" << endl; }
};

struct mule : public horse,public donkey{
    int n;
public:
    mule(){}
    mule(int a, int b, int c,int d ,int e) : n(a), horse(b,c),donkey(d,e),Animal(e) { cout << "骡子" << n << endl; }
    ~mule() { cout << "骡子析构" << endl; }
};

int main(){
    mule* m = new mule(1,2,3,4,5);
    cout <<m->n << endl;
    cout <<m->horse::n << endl;
    cout <<m->donkey::n<< endl;
    cout <<m->Animal::n << endl;

    delete m;
    return 0;
}
